package com.haomin.terra_cotta_warriors.repository;

import com.haomin.terra_cotta_warriors.data_object.Question;
import com.haomin.terra_cotta_warriors.data_object.SonClass;
import com.haomin.terra_cotta_warriors.data_view.QidAndQuestion;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface QuestionsRepo {
    @Insert("insert into questions (sid, question, words, answer) values (#{sid}, #{question}, #{words}, #{answer})")
    void insertOne(Question question);

    @Select("select qid, sid, question, words, answer from questions where sid = #{sid} ")
    List<Question> selectBiyQid(int sid);

    @Select("select qid, sid, question, words, answer from questions order by qid")
    List<Question> selectAll();
}
